package cn.qayy.service;

import cn.qayy.dto.QueryVO;
import cn.qayy.po.Policy;

import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/***
 * @author wy 
 * 
 * 协议接口
 */
public interface IPolicyService extends BasicService {
	/**
	 * 分页查询
	 * @param params
	 * @return
	 */
	PageInfo<Map<String, Object>> selectPolicyBy(Map<String, Object> params) throws Exception;
	/***
	 * 通过id 查询协议
	 * @param params
	 * @return
	 */
	Policy selectPolicyByID(@RequestParam Integer planId) throws Exception;

	/***
	 * 查询协议各字段的拼接key,用于去重复项判断
	 * 
	 * @return
	 */
	List<? extends String> selectPolicyKeys() throws Exception;
	/***
	 * 查询协议
	 * @param params
	 * @return
	 */
	List<Policy> selectPolicys(Map<String, Object> params) throws Exception;
	List<Policy> selectByMap(Map<String, Object> params);
	/**
	 * 查询id
	 * @param params
	 * @return
	 */
	List<Integer> selectIdsByMap(Map<String, Object> params);
	
	int checkRe(Policy p);
	/**
	 * 持久化
	 * @param map
	 * @param request
	 * @param object
	 * @throws Exception
	 */
	void persistence(Map<String, List<Uploadable>> map, HttpServletRequest request, HttpServletResponse response) throws Exception;
	/**
	 * 通过map参数，查询出对应的记录进行更新
	 * @param map
	 * @param request
	 * @param object
	 * @throws Exception
	 */
	void updateByParams(Map<String, Object> params,QueryVO vo,HttpServletRequest request) throws Exception;
	
	/***
	 * 根据协议集合，同步更新流向的协议ID在这些协议里的流向表
	 * @param list
	 * @throws Exception
	 */
	void updatePlansByPolicys(List<Policy> list) throws Exception;
}
